Skip to content

Refactor: Ensure correct type for PostgresDsn instantiation#69

Merged
HosseinNejatiJavaremi merged 1 commit intoSyntaxArc:masterfrom
heysaeid:refactor/ensure-postgresdsn-type
Aug 16, 2025
Merged

Refactor: Ensure correct type for PostgresDsn instantiation#69
HosseinNejatiJavaremi merged 1 commit intoSyntaxArc:masterfrom
heysaeid:refactor/ensure-postgresdsn-type

Conversation

@heysaeid
Copy link
Copy Markdown
Contributor

Summary

This PR resolves a PydanticSerializationUnexpectedValue warning that occurs when building the PostgreSQL connection DSN.

The Problem

The code was assigning a raw formatted string to a field that is typed as pydantic.networks.PostgresDsn. This caused Pydantic to raise the following warning during serialization:

pydantic/main.py:463: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected <class 'pydantic.networks.PostgresDsn'> but got <class 'str'> with value '...' - serialized value may not be as expected.)

The Solution

The fix is to explicitly instantiate the PostgresDsn class with the connection string. This ensures that the field holds an object of the correct type, leverages Pydantic's validation, and silences the warning.

@HosseinNejatiJavaremi HosseinNejatiJavaremi merged commit 9b8ef04 into SyntaxArc:master Aug 16, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants